#include"pthread_cycle_p_c.h"

typedef cycle_p_c<int> cycle;

//派发任务
void* haddle_p(void* arg)
{
    cycle *ptr=(cycle*)arg;

    for(int i=1;i<MAX;i++)
    {
        ptr->push_back(i);
    }

    return NULL;
}
//处理任务
void* haddle_c(void* arg)
{
    cycle *ptr=(cycle*)arg;

    while(1)
    {
        ptr->pop();
    }

    return NULL;
}

int main()
{
    //创建线程
    pthread_t pthread_p,pthread_c;

    cycle *ptr=new cycle;

    pthread_create(&pthread_p,NULL,haddle_p,ptr);
    pthread_create(&pthread_c,NULL,haddle_c,ptr);

    sleep(100);

    return 0;
}
